package com.milink.gateway;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;

@SpringBootApplication
@ServletComponentScan
public class SerialApplication implements CommandLineRunner {
    private static final Logger logger = LoggerFactory.getLogger(SerialApplication.class);

    @Autowired
    MyFtpServer myFtpServer;

    public static void main(String[] args) {
        SpringApplication.run(SerialApplication.class, args);

    }

    @Override
    public void run(String... args) throws Exception {
        try {
            myFtpServer.start();
            logger.info("Apache Ftp server is started!");
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("Apache Ftp server start failed!", e);
        }
    }
}

